<?php

/**
 * ListTaxCodes form.
 *
 * @package    form
 * @subpackage list_tax_codes
 * @version    SVN: $Id: sfPropelFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class ListTaxCodesForm extends BaseListTaxCodesForm
{
  public function configure()
  {
    $this->widgetSchema['tax_code']->setAttributes(array('size'=>5));
    $this->widgetSchema['description']->setAttributes(array('size'=>30));
    $this->widgetSchema['tax_rate']->setAttributes(array('size'=>5));
    $this->widgetSchema->setLabels(
      array(
        'tax_code'=>'Tax Code:',
        'description'=>'Description:',
        'tax_rate'=>'Tax Rate:',
      )
    );
    
    if($this->isNew())
      $this->validatorSchema['iden'] = new sfValidatorString(array('required' => true));
    $this->validatorSchema['tax_code']->setOption('required',true);
    $this->validatorSchema['tax_code']->setOption('min_length',5);
    $this->validatorSchema['description']->setOption('min_length',5);
    $this->validatorSchema['tax_rate']->setOption('min',1);
    
  }
  
  public function getUrl(){
    if($this->isNew())
      return 'tax_codes/insert';
    else
      return 'tax_codes/update';
  }
  
  public function getDeleteUrl(){
    return 'tax_codes/delete?iden='.$this->getObject()->getIden();
  }
  
}
